package com.kehutong.payfees.dto;

import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;

import java.time.LocalDateTime;
import java.util.Objects;

public abstract class KhtEntity extends Entity {

	private static final long serialVersionUID = -2405470600238017791L;

	protected KhtEntity(String id) {
		super(id);
	}
	
	@Column(comment="逻辑删除")
	private boolean deleted;

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	/**
	 * <pre>时间是否有效</pre>
	 * @param localDateTime
	 * @return
	 */
	protected boolean valid(LocalDateTime localDateTime) {
		if (Objects.isNull(localDateTime)) {
			return false;
		}
		
		return localDateTime.isAfter(LocalDateTime.now());
	}

}
